package com.serwis.app.entities;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="T_RETAIL_ORDER_DETAILS")
public class RetailOrderDetails implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private int orderDetailsId;
	private Product product;
	private RetailOrder retailOrder; 
	private int amount;

	public RetailOrderDetails() {
	}

	public RetailOrderDetails(Product produkt, RetailOrder retailOrder, int amount) {
		this.product = produkt;
		this.retailOrder = retailOrder;
		this.amount = amount;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="RETAIL_ORDER_DETAILS_ID",unique = true, nullable = false)
	public int getOrderDetailsId() {
		return orderDetailsId;
	}

	public void setOrderDetailsId(int orderDetailsId) {
		this.orderDetailsId = orderDetailsId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RETAIL_ORDER_PRODUCT_ID", nullable = false)
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RETAIL_ORDER_ID", nullable = false)
	public RetailOrder getRetailOrder() {
		return retailOrder;
	}

	public void setRetailOrder(RetailOrder retailOrder) {
		this.retailOrder = retailOrder;
	}

	@Column(name="AMOUNT", nullable=false)
	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	
}
